Release 10.1A: OpenEdge Development:
Programming Interfaces
Implementing single-item transfers
You can implement each clipboard operation based on the type of widget that currently has the input focus (
FOCUS:TYPE) and the state of its text selection and other attributes. For example, you can decide whether to copy all or part of an editor widget value by the values of theSELECTION-STARTandSELECTION-ENDattributes. You typically implement each clipboard operation in the trigger block of theCHOOSEevent for the corresponding Edit menu option. In this way, the user can only perform a clipboard operation associated with an Edit menu option that is enabled.The following code example implements the clipboard operations enabled by the code example in the previous section. Note that for editor widgets (
FOCUS:TYPE = "EDITOR"), if the user has text selected, the procedure transfers data between the clipboard and theSELECTION-TEXTrather than theVALUEattribute itself.Paste operations
For example, the paste operation (
ON CHOOSE OF MENU-ITEM EM_Paste) replaces only the selected text (rather than the whole text) in an editor widget with the data in the clipboard. (In a fill-in widget, paste operations always replace all data in the widget.)Cut operations
For cut operations (
ON CHOOSE OF MENU-ITEM EM_Cut), the procedure sets the appropriate widget attribute (SELECTION-TEXTorVALUE) to the empty string after transferring the data to the clipboard. The corresponding text disappears from the display as the Cut operation completes.Copy operations
Copy operations (
ON CHOOSE OF MENU-ITEM EM_Copy) are similar to cut operations except that they leave theFOCUSdata unchanged. However, if the data to be copied is a radio set, the example assumes that the character value of the radio set label visible on the display (FOCUS:LABEL) is what the user wants to copy rather than its value (FOCUS:VALUE). This is a useful implementation where the radio set represents an integer and theFOCUS:VALUEattribute contains a right-justified integer string:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |